<!DOCTYPE HTML>
<html lang="en">
<head>
<title>ListVars - Syntax &amp; Usage | AutoHotkey</title>
<meta name="description" content="The ListVars command displays the script's variables: their names and current contents." />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link href="../static/theme.css" rel="stylesheet" type="text/css" />
<script src="../static/content.js" type="text/javascript"></script>
</head>
<body>

<h1>ListVars</h1>

<p>Displays the script's <a href="../Variables.htm">variables</a>: their names and current contents.</p>

<pre class="Syntax"><span class="func">ListVars</span></pre>
<h2>Remarks</h2>
<p>This command is equivalent to selecting the &quot;View-&gt;Variables&quot; menu item in the main window. It can help you <a href="../Scripts.htm#debug">debug a script</a>.</p>
<p>For each variable in the list, the variable's name and contents are shown, along with other information depending on what the variable contains. Each item is terminated with a carriage return and newline (<code>`r`n</code>), but may span multiple lines if the variable contains <code>`r`n</code>.</p>
<p>List items may take the following forms (where words in <i>italics</i> are placeholders):</p>
<pre class="no-highlight">
<i>VarName</i>[<i>Length</i> of <i>Capacity</i>]: <i>String</i>
<em>; <span class="ver">[v1.1.26+]</span></em>
<i>VarName</i>: <i>TypeName</i> object {<i>Info</i>}
<em>; Prior to <span class="ver">[v1.1.26]</span>:</em>
<i>VarName</i>[Object]: <i>Address</i>
<i>VarName</i>[Object]: <i>Address</i> &lt;= ComObject(<i>VarType</i>, <i>Value</i>)
</pre>
<p><i>Capacity</i> is the variable's current <a href="VarSetCapacity.htm">capacity</a> measured in characters, not bytes.</p>
<p><i>String</i> is the first 60 characters of the variable's contents.</p>
<p><i>Info</i> depends on the type of object, but is currently very limited.</p>
<p>If this command is used inside a <a href="../Functions.htm">function</a>, the function's <a href="../Functions.htm#Local">local variables</a> will be listed first (above the script's global variables).</p>
<p>Known limitation: If a <a href="../Functions.htm">function</a> (or the list of global variables itself) contains more than 10,000 variables, this command might not show them in exact alphabetical order; that is, some might be missing from the display.</p>

<h2>Related</h2>
<p><a href="KeyHistory.htm">KeyHistory</a>, <a href="ListHotkeys.htm">ListHotkeys</a>, <a href="ListLines.htm">ListLines</a></p>
<p>The <a href="https://github.com/Lexikos/DebugVars.ahk#debugvars">DebugVars</a> script can be used to inspect and change the contents of variables and objects.</p>

<h2>Examples</h2>
<div class="ex" id="ExBasic">
<p><a href="#ExBasic">#1</a></p>
<pre>ListVars</pre>
</div>

</body>
</html>
